# Maintainer: Daniel Isaksen <d@duniel.no>
pkgname=yara
pkgver=4.0.1
pkgrel=0
pkgdesc="The pattern matching swiss knife for malware researchers"
url="https://virustotal.github.io/yara/"
arch="all !armhf !armv7"  # armhf: tests fail
license="BSD-3-Clause"
makedepends="automake file-dev openssl-dev autoconf libtool flex"
source="$pkgname-$pkgver.tar.gz::https://github.com/VirusTotal/yara/archive/v$pkgver.tar.gz
remove-test-rules.patch"
subpackages="$pkgname-doc"

prepare() {
	default_prepare
	autoreconf -fiv
}

build() {
	./configure \
		--prefix=/usr \
		--with-crypto \
		--enable-magic
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm 644 COPYING "$pkgdir/usr/share/licenses/$pkgname"/COPYING
	install -Dm 644 README.md "$pkgdir/usr/share/doc/$pkgname"/README.md
	cp -r docs "$pkgdir/usr/share/doc/$pkgname"
}

sha512sums="5d91b8df242299084916d9634e950359e7a9df26a7964ca2ca52cecf79a969d5aefd1c2dd89f5e762cf3a3c907cd616bd738b540f8600ad94522cbc3f1b031d3  yara-4.0.1.tar.gz
dd3de272614fdfe2ee4658eacacdc54213af44879c1756f2432294221f5fba23e8de028da43f1d47e69c9209266f7d49a6619d7e1af9ef71bc14d07549ad3df1  remove-test-rules.patch"
